package com.spark.lola.filter;

import com.spark.lola.support.shiro.service.ShiroFilterService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service("shiroFilterService")
public class HuaRongShiroFilterImpl implements ShiroFilterService {

    @Value("${swagger.enable}")
    private boolean swaggerEnable;

    @Override
    public void loadExtendShiroFileter(Map<String, String> filterChainDefinitionMap) {
        filterChainDefinitionMap.put("/rpc/**/", "anon");
        //filterChainDefinitionMap.put("/auth/**", "anon");

        if (swaggerEnable) {
            filterChainDefinitionMap.put("/api/**", "anon");
            filterChainDefinitionMap.put("/swagger-ui.html", "anon");
            filterChainDefinitionMap.put("/swagger-resources/**", "anon");
            filterChainDefinitionMap.put("/v2/**", "anon");
            filterChainDefinitionMap.put("/webjars/**", "anon");
        }

    }
}
